<?
require_once('NumberConverter.php');

class NumberConverterTest extends PHPUnit_Framework_TestCase {
	protected $c;
	protected function setUp() {
		$this->c= new NumberConverter;
	}
	public function testGetAsDatatype() {
		$this->assertNull($this->c->getAsDatatype(null));
		$this->assertNull($this->c->getAsDatatype(''));

		$this->assertEquals(0,$this->c->getAsDatatype('0'));
		$this->assertEquals(1,$this->c->getAsDatatype('1'));
		$this->assertEquals(0,$this->c->getAsDatatype('asd1'));
		$this->assertEquals(0,$this->c->getAsDatatype('asd2asd'));
		$this->assertEquals(1,$this->c->getAsDatatype('1asd2asda'));
		$this->assertEquals(3.4,$this->c->getAsDatatype('3.4asd6asda'));
	}
	public function testException() {
		$this->setExpectedException('ConverterException');
		$this->c->getAsDatatype('qweq');
	}
}
